package com.report.controller;

import com.report.dto.response.LineChartRes;
import com.report.dto.response.PanelGroupRes;
import com.report.dto.response.SearchRes;
import com.report.service.IMemberService;
import com.report.service.ISearchService;
import com.zmh.framework.util.Result;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author summer
 * @version 1.0
 * @date 2024/9/4 11:38
 * 统计
 */
@RestController
@RequestMapping(value = "/census")
@AllArgsConstructor
public class CensusController {

    private final IMemberService memberService;

    @GetMapping(value = "/panelGroup")
    public Result<PanelGroupRes> panelGroup(){
        PanelGroupRes panelGroupRes= memberService.panelGroup();
        return Result.successResult(panelGroupRes);
    }

    @GetMapping(value = "/lineChart")
    public Result<LineChartRes> lineChart(){
        LineChartRes lineChartRes = memberService.lineChart();
        return Result.successResult(lineChartRes);
    }

    private final ISearchService searchService;

    @GetMapping(value = "/searchLists/{type}")
    public Result<List<SearchRes>>  searchLists(@PathVariable Integer type){
        List<SearchRes> searchRes= searchService.lists(type);
        return Result.successResult(searchRes);
    }



}
